﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Controls_Registration_StageIndicator : System.Web.UI.UserControl
{
	public int CurrentStage { get; set; }
	protected void Page_Load(object sender, EventArgs e)
	{
		SetSelectedStageCss();
	}

	private void SetSelectedStageCss()
	{
		var panelCollection = new List<Panel>();
		foreach (var ctrl in stages.Controls)
		{
			if (ctrl.GetType() == typeof(Panel))
			{
				var pnl = (Panel)ctrl;
				pnl.CssClass = "StageItem";
				panelCollection.Add(pnl);
			}
		}

		if (CurrentStage <= panelCollection.Count && CurrentStage > 0)
			panelCollection[CurrentStage - 1].CssClass = "StageItem Selected";
	}
}